import request from '@/utils/request'
//导出是export default 以后 你导入的时候 必须取一个名字

export default {

  addCourseInfo(courseInfo) {
    return request({
      url: `/course/addCourseInfo`,
      method: 'post',
      data: courseInfo
    })
  },
  findCourseInfo(courseId) {
    return request({
      url: `/course/getCourseAndDes/${courseId}`,
      method: 'post',
    })
  },
  updateCourse(courseInfo) {
    return request({
      url: `/course/updateCourseInfo`,
      method: 'post',
      data: courseInfo
    })
  },
  uploadImage(file) {
    return request({
      url: "http://localhost:8080//eduservice/teacher/uploadAvatar",
      method: 'post',
      data: file
    })
  },
  getCourseAndTeacherById(courseId) {
    return request({
      url: `/course/getCourseTeacher/${courseId}`,
      method: 'post',
    })
  },
  publishCourse(courseId){
    return request({
      url: `/course/publishCourse/${courseId}`,
      method: 'post',
    })
  },
  findCourseByPage(currentPage, limit) {
    return request({
      url: `/course/conditionsQuery/${currentPage}/${limit}`,
      method: 'post',
    })
  },
  deleteCourseById(courseId) {
    return request({
      url: `/course/deleteCourse/${courseId}`,
      method: 'post',
    })
  }
}

// 通用上传请求
// export function uploadImage(file) {
//   return request({
//     url: "http://localhost:8080//eduservice/teacher/uploadAvatar",
//     method: 'post',
//     data: file
//   })
// }
